<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>documentName</title>
  </head>

  <body>
    <a href="https://www.baidu.com">跳转</a>
    <a href="https://www.baidu.com">跳转</a>

    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
    <script>
      $('a').attr('href', function (index, oldvalue) {
        console.log('多个时的参数', index, oldvalue)
        if (index === 0) {
          return 'https://www.ip.top/'
        }
      })
    </script>
  </body>
</html>
